

$('#stu_inTime').datetimepicker({
    minView: "month",
    language: 'zh-CN',
    format: 'yyyy-mm-dd',
    todayBtn: 1,
    autoclose: true,
    startDate:'2015-09-01'
});
$('#stu_outTime').datetimepicker({
    minView: "month",
    language: 'zh-CN',
    format: 'yyyy-mm-dd',
    todayBtn: 1,
    autoclose: true,
    startDate:'2015-09-01'
});



var provenceArr = ["北京市","天津市","上海市","重庆市","河北省","山西省","内蒙古","辽宁省","吉林省","黑龙江省","江苏省","浙江省","安徽省","福建省","江西省","山东省","河南省","湖北省","湖南省","广东省","广西","海南省","四川省","贵州省","云南省","西藏","陕西省","甘肃省","青海省","宁夏","新疆","香港","澳门","台湾省"];
var cityArr = new Array();
cityArr["陕西省"] = ["西安市","延安市","铜川市","渭南市","咸阳市","宝鸡市","汉中市","榆林市","安康市","商洛市"];
cityArr["山西省"] = ["太原市","临汾市","大同市","吕梁市","阳泉市","运城市","晋中市","长治市","晋城市","朔州市","忻州市"];
cityArr["北京市"] = ["北京市"];
cityArr["上海市"] = ["上海市"];
cityArr["天津市"] = ["天津市"];
cityArr["重庆市"] = ["重庆市"];
cityArr["广东省"] = ["广州市","深圳市","佛山市","东莞市","中山市","珠海市","江门市","肇庆市","惠州市","汕头市","潮州市","揭阳市","阳江市","韶关市","梅州市","清远市"];
cityArr["河北省"] = ["河北省"];
cityArr["山西省"] = ["山西省"];
cityArr["内蒙古"] = ["内蒙古"];
cityArr["辽宁省"] = ["辽宁省"];
cityArr["吉林省"] = ["吉林省"];
cityArr["黑龙江省"] = ["黑龙江省"];
cityArr["江苏省"] = ["江苏省"];
cityArr["浙江省"] = ["浙江省"];
cityArr["安徽省"] = ["安徽省"];
cityArr["福建省"] = ["福建省"];
cityArr["浙江省"] = ["浙江省"];
var countyArr = new Array();
countyArr["西安市"] = ["新城区","碑林区","莲湖区","灞桥区","未央区","雁塔区","阎良区","临潼区","长安区","蓝田县","周至县","户县","高陵区"];
countyArr["咸阳市"] = ["渭城区","秦都区","礼泉县","乾县","兴平","三原县","泾阳县","永寿县","彬县","长武县","旬邑县","淳化县","武功县"];
countyArr["商洛市"] = ["商州区","洛南县","丹凤县","商南县","山阳县","镇安县","柞水县"];
countyArr["渭南市"] = ["临渭区","华州区","潼关县","大荔县","蒲城县","澄城县","白水县","合阳县","富平县","韩城","华阴"];
countyArr["延安市"] = ["宝塔区","延长县","延川县","子长县","安塞县","志丹县","吴起县","甘泉县","富县","洛川县","宜川县","黄龙县","黄陵县"];
countyArr["铜川市"] = ["王益区","印台区","耀州区","宜君县"];
countyArr["宝鸡市"] = ["渭滨区","金台区","陈仓区","宝鸡蟠龙新区","宝鸡陆港新区","岐山县","扶风县","眉县","凤翔县","陇县","千阳县","麟游县","凤县","太白县"];
countyArr["汉中市"] = ["汉台区","南郑县","城固县","洋县","西乡县","勉县","宁强县","略阳县","镇巴县","留坝县" ,"佛坪县"];
countyArr["榆林市"] = ["榆阳区","横山区","神木县","绥德县","靖边县","定边县","府谷县","子洲县","米脂县","吴堡县","清涧县","佳县"];
countyArr["安康市"] = ["汉滨区","汉阴县","石泉县","宁陕县","紫阳县","岚皋县","平利县","镇坪县","旬阳县","白河县"];
countyArr["北京市"] = ["东城区","西城区","海淀区","朝阳区","丰台区","石景山区","门头沟区","通州区","顺义区","房山区","大兴区","昌平区","怀柔区","平谷区","密云区","延庆区"];
countyArr["上海市"] = ["黄浦区","浦东新区","徐汇区","长宁区","静安区","普陀区","虹口区","杨浦区","闵行区","宝山区","嘉定区","金山区","松江区","青浦区","奉贤区","崇明县"];
countyArr["天津市"] = ["和平区","河西区","南开区","河东区","河北区","红桥区","滨海新区","东丽区","西青区","津南区","北辰区","武清区","宝坻区","静海区​","蓟州区"];

var directionArr =["考研","工作","考公务员"];
var  employmentStatusArr = new Array();
employmentStatusArr["考研"] =["考研","升学"];
employmentStatusArr["工作"] =["短期实习","就业实习","就业未实习","就业工作","在校"];
employmentStatusArr["考公务员"] =["考公务员"];


var natureArr =["国有企业","国有控股企业","外资企业","合资企业","私营企业","事业单位","国家行政机关"];
var industryArr = ["农业","林业","畜牧业","渔业","计算机服务和软件业","采矿业","制造业"," 电力","燃气及水的生产和供应业","建筑业","交通运输","仓储和邮政业" ,"批发和零售业"," 住宿和餐饮业","金融业"," 房地产业"," 租赁和商务服务业" ,"科学研究","技术服务和地质勘查业"," 水利","环境和公共设施管理业" ,"居民服务和其他服务业", "教育","卫生医疗","社会保障和社会福利业" ,"文化、体育和娱乐业"]

window.onload = function () {
    allDepartment();
    allProvence();
    allCompProvence();
    allFromProvence();
    selectAllteacher();
    allNature();
    allIndustry();
    allDirection();
    divFor();
    loadCode();
};




function allDirection(){
    var stu_compjobdirection = document.getElementById("stu_compjobdirection");
    for(var i = 0; i < directionArr.length; i++)
    {
        var o_l = new Option(directionArr[i],directionArr[i]);
        stu_compjobdirection.options.add(o_l);
    }
}

function selectemploymentStatus()
{
    var stu_compjobdirection = document.getElementById("stu_compjobdirection").value;
    var stu_compjobstatus = document.getElementById("stu_compjobstatus");
    stu_compjobstatus.options.length = 0;
    if(stu_compjobdirection == "")
    {
        var option = new Option("在校","在校");
        stu_compjobstatus.options.add(option);
    }else{
        for(var i = 0; i < employmentStatusArr[stu_compjobdirection].length; i++)
        {
            var o_l = new Option(employmentStatusArr[stu_compjobdirection][i],employmentStatusArr[stu_compjobdirection][i]);
            stu_compjobstatus.options.add(o_l);
        }
    }
}





function allIndustry(){
    var stu_compkind = document.getElementById("stu_compkind");
    for(var i = 0; i < industryArr.length; i++)
    {
        var o_l = new Option(industryArr[i],industryArr[i]);
        stu_compkind.options.add(o_l);
    }
}

function allNature(){
    var stu_compnature = document.getElementById("stu_compnature");
    for(var i = 0; i < natureArr.length; i++)
    {
        var o_l = new Option(natureArr[i],natureArr[i]);
        stu_compnature.options.add(o_l);
    }
}

function selectAllteacher(){
    $.ajax({
        url : 'user/selectAllTeacher',
        type : "POST",
        success : function(result) {
            if(result!=null){
                for(var i =0;i<result.length;i++){
                    var option = document.createElement("option");
                    $(option).val(result[i].tea_name);
                    $(option).text(result[i].tea_name);
                    $('#stu_compjobguide').append(option);
                }
            }
        },
        error : function(data) {

        }
    });
}


function allFromProvence(){
    var stu_fromprovince = document.getElementById("stu_fromprovince");
    for(var i = 0; i < provenceArr.length; i++)
    {
        var o_l = new Option(provenceArr[i],provenceArr[i]);
        stu_fromprovince.options.add(o_l);
    }
}

function selectFromCity()
{
    var stu_fromprovince = document.getElementById("stu_fromprovince").value;
    var stu_fromcity = document.getElementById("stu_fromcity");
    stu_fromcity.options.length = 0;
    if(stu_fromprovince == "")
    {
        var option = new Option("西安市","西安市");
        stu_fromcity.options.add(option);
    }else{
        for(var i = 0; i < cityArr[stu_fromprovince].length; i++)
        {
            var o_l = new Option(cityArr[stu_fromprovince][i],cityArr[stu_fromprovince][i]);
            stu_fromcity.options.add(o_l);
        }
    }
}


function allCompProvence(){
    var stu_compprovince = document.getElementById("stu_compprovince");
    for(var i = 0; i < provenceArr.length; i++)
    {
        var o_l = new Option(provenceArr[i],provenceArr[i]);
        stu_compprovince.options.add(o_l);
    }
}

function selectCompCity()
{
    var stu_compprovince = document.getElementById("stu_compprovince").value;
    var stu_compcity = document.getElementById("stu_compcity");
    stu_compcity.options.length = 0;
    if(stu_compprovince == "")
    {
        var option = new Option("西安市","西安市");
        stu_compcity.options.add(option);
    }else{
        for(var i = 0; i < cityArr[stu_compprovince].length; i++)
        {
            var o_l = new Option(cityArr[stu_compprovince][i],cityArr[stu_compprovince][i]);
            stu_compcity.options.add(o_l);
        }
    }
}

function selectCompCounty()
{
    var stu_compcity = document.getElementById("stu_compcity").value;
    var stu_compcounty = document.getElementById("stu_compcounty");
    stu_compcounty.options.length = 0;
    if(stu_compcity == "")
    {
        var option = new Option("雁塔区","雁塔区");
        stu_compcounty.options.add(option);
    }else{
        for(var i = 0; i < countyArr[stu_compcity].length; i++)
        {
            var o_l = new Option(countyArr[stu_compcity][i],countyArr[stu_compcity][i]);
            stu_compcounty.options.add(o_l);
        }
    }
}

function allProvence(){
    var stu_province = document.getElementById("stu_province");
    for(var i = 0; i < provenceArr.length; i++)
    {
        var o_l = new Option(provenceArr[i],provenceArr[i]);
        stu_province.options.add(o_l);
    }
}

function selectCity()
{
    var stu_province = document.getElementById("stu_province").value;
    var stu_city = document.getElementById("stu_city");
    stu_city.options.length = 0;
    if(stu_province == "")
    {
        var option = new Option("西安市","西安市");
        stu_city.options.add(option);
    }else{
        for(var i = 0; i < cityArr[stu_province].length; i++)
        {
            var o_l = new Option(cityArr[stu_province][i],cityArr[stu_province][i]);
            stu_city.options.add(o_l);
        }
    }
}

function selectCounty()
{
    var stu_city = document.getElementById("stu_city").value;
    var stu_county = document.getElementById("stu_county");
    stu_county.options.length = 0;
    if(stu_city == "")
    {
        var option = new Option("雁塔区","雁塔区");
        stu_county.options.add(option);
    }else{
        for(var i = 0; i < countyArr[stu_city].length; i++)
        {
            var o_l = new Option(countyArr[stu_city][i],countyArr[stu_city][i]);
            stu_county.options.add(o_l);
        }
    }
}


var arr = ["人文学院","艺术学院","健康管理学院","经济管理学院","马克思主义学院","城乡规划与建筑工程学院","数学与计算机应用学院","电子信息与电信工程学院","化学工程与现代材料学院","生物医药与食品工程学院"];
var proList = new Array();

proList["经济管理学院"] = ["信息管理与信息系统", "电子商务", "会计学", "文化产业管理","财务管理"];
proList["人文学院"] = ["汉语言文学", "英语", "秘书学", "历史学", "网络与新媒体"];
proList["艺术学院"] = ["美术学", "音乐学", "学前教育"];
proList["健康管理学院"] = ["护理学", "应用心理学", "康复治疗学", "食品卫生与营养学"];
proList["马克思主义学院"] = ["思想政治教育"];
proList["城乡规划与建筑工程学院"] = ["地理科学", "人文地理与城乡规划", "工程管理", "土木工程"];
proList["数学与计算机应用学院"] = ["数学与应用数学", "计算机科学与技术", "网络工程", "应用统计学"];
proList["电子信息与电信工程学院"] = ["物理学", "电子信息科学与技术","电子信息工程","电气工程及其自动化"];
proList["化学工程与现代材料学院"] = ["化学", "应用化学", "金属材料工程", "资源循环科学与工程"];
proList["生物医药与食品工程学院"] = ["园林", "生物技术","食品科学与工程","制药工程"];


function allDepartment(){
    var stu_department = document.getElementById("stu_department");
    for(var i = 0; i < arr.length; i++)
    {
        var o_l = new Option(arr[i],arr[i]);
        stu_department.options.add(o_l);
    }
}

function selectProfession()
{
    var stu_department = document.getElementById("stu_department").value;
    var stu_profession = document.getElementById("stu_profession");

    stu_profession.options.length = 0;
    if(stu_department == "")
    {
        var option = new Option("信息管理与信息系统","信息管理与信息系统");
        stu_profession.options.add(option);
    }else{
        for(var i = 0; i < proList[stu_department].length; i++)
        {
            var o_l = new Option(proList[stu_department][i],proList[stu_department][i]);
            stu_profession.options.add(o_l);
        }
    }
}


var username= window.sessionStorage.getItem("stu_u_name");
document.getElementById("currentuser").innerHTML = username;
function clicklogo(){
    window.location.href = "showCompInfoIndex";
};

function general(){
    window.location.href = "general";
};

function resumeInfo(){
    window.location.href = "resumeInfo";
};


function TimeTable(){
    window.location.href = "stutimetable";
};
function sut_stroke(){
    window.location.href = "sut_stroke";
};


function compshow(){
    window.location.href = "compshow";
};

function attentcompshow(){
    window.location.href = "attentcompshow";
};


function stuOnline(){
    window.location.href = "stuOnline";
};

function submitStuBaseInfo(){
    var stu_province = document.getElementById("stu_province").value;
    var stu_city = document.getElementById("stu_city").value;
    var stu_county = document.getElementById("stu_county").value;
    var stu_fromprovince = document.getElementById("stu_fromprovince").value;
    var stu_fromcity = document.getElementById("stu_fromcity").value;
    var stu_sex = document.getElementById("stu_sex").value;
    var stu_politics = document.getElementById("stu_politics").value;

    var stu_name = document.getElementById("stu_name").value;
    var stu_sex = document.getElementById("stu_sex").value;
    var stu_idcard = document.getElementById("stu_idcard").value;
    var stu_tel = document.getElementById("stu_tel").value;
    var stu_counselor = document.getElementById("stu_counselor").value;
    if(stu_name == null || stu_name==''){
        swal("姓名不能为空!", "请输入姓名以完成基础信息完善", "error");
        return false;
    }
    if(stu_sex == null || stu_sex==''){
        swal("性别不能为空!", "请选择性别以完成基础信息完善", "error");
        return false;
    }
    if(stu_idcard == null || stu_idcard==''){
        swal("身份证号码不能为空!", "请输入身份证号码以完成基础信息完善", "error");
        return false;
    }
    if(stu_tel == null || stu_tel==''){
        swal("电话号码不能为空!", "请输入电话号码以完成基础信息完善", "error");
        return false;
    }
    if(stu_counselor == null || stu_counselor==''){
        swal("辅导员姓名不能为空!", "请输入辅导员姓名以完成基础信息完善", "error");
        return false;
    }
    var data = $( '#myFormInfo').serialize();//表单序列化 form表单的id属性值
    data = data+"&stu_province ="+stu_province+"&stu_city="+stu_city+"&stu_county="+stu_county+"&stu_fromprovince = "+stu_fromprovince+"&stu_fromcity="+stu_fromcity+"&stu_politics="+stu_politics+"&stu_sex="+stu_sex;
    $.ajax({
        url : 'user/submitStuBaseInfo',
        type : "POST",
        data:data,
        success : function(result) {
            if(result=='已保存'){
                swal("保存成功!", "您的个人基础信息已经录入本系统!", "success");
            }else{

            }
        },
        error : function(data) {

        }
    });
}

function selectStuBaseInfo(){
    $.ajax({
        url : 'user/selectStuBaseInfo',
        type : "POST",
        success : function(result) {
            if(result!=null){

                if(result.stu_address!='0'){
                    document.getElementById("stu_address").value=result.stu_address;
                }
                if(result.stu_address=='undefined'||result.stu_address==undefined){
                    document.getElementById("stu_address").value='';
                }

                if(result.stu_counselor!='0'){
                    document.getElementById("stu_counselor").value=result.stu_counselor;
                }
                if(result.stu_counselor=='undefined'||result.stu_counselor==undefined){
                    document.getElementById("stu_counselor").value='';
                }

                if(result.stu_ec!='0'){
                    document.getElementById("stu_ec").value=result.stu_ec;
                }
                if(result.stu_ec=='undefined'||result.stu_ec==undefined){
                    document.getElementById("stu_ec").value='';
                }

                if(result.stu_ectel!='0'){
                    document.getElementById("stu_ectel").value=result.stu_ectel;
                }
                if(result.stu_ectel=='undefined'||result.stu_ectel==undefined){
                    document.getElementById("stu_ectel").value='';
                }

                if(result.stu_email!='0'){
                    document.getElementById("stu_email").value=result.stu_email;
                }
                if(result.stu_email=='undefined'||result.stu_email==undefined){
                    document.getElementById("stu_email").value='';
                }


                if(result.stu_idcard!='0'){
                    document.getElementById("stu_idcard").value=result.stu_idcard;
                }
                if(result.stu_idcard=='undefined'||result.stu_idcard==undefined){
                    document.getElementById("stu_idcard").value='';
                }

                if(result.stu_name!='0'){
                    document.getElementById("stu_name").value=result.stu_name;
                }
                if(result.stu_name=='undefined'||result.stu_name==undefined){
                    document.getElementById("stu_name").value='';
                }

                if(result.stu_qq!='0'){
                    document.getElementById("stu_qq").value=result.stu_qq;
                }
                if(result.stu_qq=='undefined'||result.stu_qq==undefined){
                    document.getElementById("stu_qq").value='';
                }

                if(result.stu_tel!='0'){
                    document.getElementById("stu_tel").value=result.stu_tel;
                }
                if(result.stu_tel=='undefined'||result.stu_tel==undefined){
                    document.getElementById("stu_tel").value='';
                }

                if(result.stu_province!='0'){
                    document.getElementById("stu_province").value=result.stu_province;
                }
                if(result.stu_province=='undefined'||result.stu_province==undefined){
                    document.getElementById("stu_province").value='';
                }

                if(result.stu_city!='0'){
                    // document.getElementById("stu_profession").value=result.stu_profession;
                    var option = document.createElement("option");
                    $(option).val(result.stu_city);
                    $(option).text(result.stu_city);
                    $('#stu_city').append(option);
                }
                if(result.stu_city=='undefined'||result.stu_city==undefined){
                    document.getElementById("stu_city").value='';
                }

                if(result.stu_county!='0'){
                    // document.getElementById("stu_profession").value=result.stu_profession;
                    var option = document.createElement("option");
                    $(option).val(result.stu_county);
                    $(option).text(result.stu_county);
                    $('#stu_county').append(option);
                }
                if(result.stu_county=='undefined'||result.stu_county==undefined){
                    document.getElementById("stu_county").value='';
                }

                if(result.stu_fromprovince!='0'){
                    document.getElementById("stu_fromprovince").value=result.stu_fromprovince;
                }
                if(result.stu_fromprovince=='undefined'||result.stu_fromprovince==undefined){
                    document.getElementById("stu_fromprovince").value='';
                }

                if(result.stu_fromcity!='0'){
                    // document.getElementById("stu_profession").value=result.stu_profession;
                    var option = document.createElement("option");
                    $(option).val(result.stu_fromcity);
                    $(option).text(result.stu_fromcity);
                    $('#stu_fromcity').append(option);
                }
                if(result.stu_fromcity=='undefined'||result.stu_fromcity==undefined){
                    document.getElementById("stu_fromcity").value='';
                }

                if(result.stu_sex!='0'){
                    document.getElementById("stu_sex").value=result.stu_sex;
                }
                if(result.stu_sex=='undefined'||result.stu_sex==undefined){
                    document.getElementById("stu_sex").value='';
                }

                if(result.stu_politics!='0'){
                    document.getElementById("stu_politics").value=result.stu_politics;
                }
                if(result.stu_politics=='undefined'||result.stu_politics==undefined){
                    document.getElementById("stu_politics").value='';
                }



            }
        },
        error : function(data) {

        }
    });
}
function fix(num, length) {
    return ('' + num).length < length ? ((new Array(length + 1)).join('0') + num).slice(-length) : '' + num;
}

function submitStuStatusInfo(){
    var stu_education = document.getElementById("stu_education").value;
    var stu_inway = document.getElementById("stu_inway").value;
    var stu_inTime = document.getElementById("stu_inTime").value;
    var stu_outTime = document.getElementById("stu_outTime").value;
    var stu_profession = document.getElementById("stu_profession").value;

    var stu_code = document.getElementById("stu_code").value;
    var stu_department = document.getElementById("stu_department").value;
    var stu_class = document.getElementById("stu_class").value;
    if(stu_code == null || stu_code==''){
        swal("学号不能为空!", "请输入学号以完成学籍信息完善", "error");
        return false;
    }
    if(stu_department == null || stu_department==''){
        swal("院系不能为空!", "请选择所在院系以完成学籍信息完善", "error");
        return false;
    }
    if(stu_profession == null || stu_profession==''){
        swal("专业不能为空!", "请选择专业以完成学籍信息完善", "error");
        return false;
    }
    if(stu_class == null || stu_class==''){
        swal("班级不能为空!", "请输入班级以完成学籍信息完善", "error");
        return false;
    }
    if(stu_education == null || stu_education==''){
        swal("学历不能为空!", "请选择学历以完成学籍信息完善", "error");
        return false;
    }
    var data = $( '#myFormStatus').serialize();//表单序列化 form表单的id属性值
    data = data+'&stu_education='+stu_education+'&stu_inway='+stu_inway+'&stu_inTime='+stu_inTime+'&stu_outTime='+stu_outTime+"&stu_profession="+stu_profession;
    $.ajax({
        url : 'user/submitStuStatusInfo',
        data:data,
        success : function(result) {
            if(result=='已保存'){
                swal("保存成功!", "您的个人学籍信息已经录入本系统!", "success");
            }else{

            }
        },
        error : function(data) {

        }
    });
}

function selectStuStatusInfo(){



    $.ajax({
        url : 'user/selectStuStatusInfo',
        type : "POST",
        success : function(result) {
            document.getElementById("stu_schoolname").value='商洛学院';
            if(result!=null){

                if(result.stu_code!='0'){
                    document.getElementById("stu_code").value=result.stu_code;
                }
                if(result.stu_code=='undefined'||result.stu_code==undefined){
                    document.getElementById("stu_code").value='';
                }

                if(result.stu_department!='0'){
                    document.getElementById("stu_department").value=result.stu_department;
                }
                if(result.stu_department=='undefined'||result.stu_department==undefined){
                    document.getElementById("stu_department").value='';
                }

                if(result.stu_profession!='0'){
                    // document.getElementById("stu_profession").value=result.stu_profession;
                    var option = document.createElement("option");
                    $(option).val(result.stu_profession);
                    $(option).text(result.stu_profession);
                    $('#stu_profession').append(option);
                }
                if(result.stu_profession=='undefined'||result.stu_profession==undefined){
                    document.getElementById("stu_profession").value='';
                }

                if(result.stu_class!='0'){
                    document.getElementById("stu_class").value=result.stu_class;
                }
                if(result.stu_class=='undefined'||result.stu_class==undefined){
                    document.getElementById("stu_class").value='';
                }

                if(result.stu_education!='0'){
                    document.getElementById("stu_education").value=result.stu_education;
                }
                if(result.stu_education=='undefined'||result.stu_education==undefined){
                    document.getElementById("stu_education").value='';
                }

                if(result.stu_inway!='0'){
                    document.getElementById("stu_inway").value=result.stu_inway;
                }
                if(result.stu_inway=='undefined'||result.stu_inway==undefined){
                    document.getElementById("stu_inway").value='';
                }

                if(result.stu_inTime!='0'){
                    document.getElementById("stu_inTime").value=result.stu_inTime;
                }
                if(result.stu_inTime=='undefined'||result.stu_inTime==undefined){
                    document.getElementById("stu_inTime").value='';
                }

                if(result.stu_outTime!='0'){
                    document.getElementById("stu_outTime").value=result.stu_outTime;
                }
                if(result.stu_outTime=='undefined'||result.stu_outTime==undefined){
                    document.getElementById("stu_outTime").value='';
                }


            }
        },
        error : function(data) {

        }
    });
}




function submitStuJobInfo(){
    var stu_compprovince = document.getElementById("stu_compprovince").value;
    var stu_compcity = document.getElementById("stu_compcity").value;
    var stu_compcounty = document.getElementById("stu_compcounty").value;
    var data = $( '#myFormJob').serialize();//表单序列化 form表单的id属性值
    data = data+"&stu_compprovince ="+stu_compprovince+"&stu_compcity="+stu_compcity+"&stu_compcounty="+stu_compcounty;
    var stu_compjobstatus = $("#stu_compjobstatus")["0"].selectedOptions["0"].innerText;
    data = data+'&stu_compjobstatus='+stu_compjobstatus;
    $.ajax({
        url : 'user/submitStuJobInfo',
        data:data,
        success : function(result) {
            swal("保存成功!", "您的个人就业信息已经录入本系统!", "success");
        },
        error : function(data) {

        }
    });
}


function selectStuJobInfo(){
    $.ajax({
        url : 'user/selectStuJobInfo',
        type : "POST",
        success : function(result) {
            if(result!=null){
                if(result.stu_compagreement!='0'){
                    document.getElementById("stu_compagreement").value=result.stu_compagreement;
                }
                if(result.stu_compagreement=='undefined'||result.stu_compagreement==undefined){
                    document.getElementById("stu_compagreement").value='';
                }

                if(result.stu_compjobstatus!='0'){
                    var option = document.createElement("option");
                    $(option).val(result.stu_compjobstatus);
                    $(option).text(result.stu_compjobstatus);
                    $('#stu_compjobstatus').append(option);
                }
                if(result.stu_compjobstatus=='undefined'||result.stu_compjobstatus==undefined){
                    document.getElementById("stu_compjobstatus").value='';
                }

                if(result.stu_updateagreement!='0'){
                    document.getElementById("stu_updateagreement").value=result.stu_updateagreement;
                }
                if(result.stu_updateagreement=='undefined'||result.stu_updateagreement==undefined){
                    document.getElementById("stu_updateagreement").value='';
                }

                if(result.stu_compname!='0'){
                    document.getElementById("stu_compname").value=result.stu_compname;
                }
                if(result.stu_compname=='undefined'||result.stu_compname==undefined){
                    document.getElementById("stu_compname").value='';
                }

                if(result.stu_compcode!='0'){
                    document.getElementById("stu_compcode").value=result.stu_compcode;
                }
                if(result.stu_compcode=='undefined'||result.stu_compcode==undefined){
                    document.getElementById("stu_compcode").value='';
                }

                if(result.stu_compnature!='0'){
                    document.getElementById("stu_compnature").value=result.stu_compnature;
                }
                if(result.stu_compnature=='undefined'||result.stu_compnature==undefined){
                    document.getElementById("stu_compnature").value='';
                }

                if(result.stu_compkind!='0'){
                    document.getElementById("stu_compkind").value=result.stu_compkind;
                }
                if(result.stu_compkind=='undefined'||result.stu_compkind==undefined){
                    document.getElementById("stu_compkind").value='';
                }

                if(result.stu_compaddress!='0'){
                    document.getElementById("stu_compaddress").value=result.stu_compaddress;
                }
                if(result.stu_compaddress=='undefined'||result.stu_compaddress==undefined){
                    document.getElementById("stu_compaddress").value='';
                }

                if(result.stu_compjob!='0'){
                    document.getElementById("stu_compjob").value=result.stu_compjob;
                }
                if(result.stu_compjob=='undefined'||result.stu_compjob==undefined){
                    document.getElementById("stu_compjob").value='';
                }

                if(result.stu_compjobguide!='0'){
                    document.getElementById("stu_compjobguide").value=result.stu_compjobguide;
                }
                if(result.stu_compjobguide=='undefined'||result.stu_compjobguide==undefined){
                    document.getElementById("stu_compjobguide").value='';
                }



                if(result.stu_compprovince!='0'){
                    document.getElementById("stu_compprovince").value=result.stu_compprovince;
                }
                if(result.stu_compprovince=='undefined'||result.stu_compprovince==undefined){
                    document.getElementById("stu_compprovince").value='';
                }

                if(result.stu_compcity!='0'){
                    var option = document.createElement("option");
                    $(option).val(result.stu_compcity);
                    $(option).text(result.stu_compcity);
                    $('#stu_compcity').append(option);
                }
                if(result.stu_compcity=='undefined'||result.stu_compcity==undefined){
                    document.getElementById("stu_compcity").value='';
                }

                if(result.stu_compcounty!='0'){
                    var option = document.createElement("option");
                    $(option).val(result.stu_compcounty);
                    $(option).text(result.stu_compcounty);
                    $('#stu_compcounty').append(option);
                }
                if(result.stu_compcounty=='undefined'||result.stu_compcounty==undefined){
                    document.getElementById("stu_compcounty").value='';
                }


            }
        },
        error : function(data) {

        }
    });
}


function deleteAcount(){
    swal({
        title: "确认注销账号吗?",
        text: "账号一旦注销,将无法找回,注册不易,且行且珍惜",
        icon : "warning",
        dangerMode : true,
        buttons : [ "考虑一下", "含泪注销"],
    }).then(function(ok){
        if (ok) {
            $.ajax({
                url : 'user/studeleteAcount',
                method : 'delete',
                dataType : 'json',
                success : function(result) {
                    if(result == '已注销'){
                        swal("注销成功!", "期待您下次使用本系统!", "success");
                        window.location.href = "login";
                    }else{
                        swal("注销失败!", "你的账户目前不能被注销!", "error");
                    }
                },
                error : function(data) {
                    swal("注销成功!", "期待您下次使用本系统!", "success");
                    window.location.href = "login";
                }
            });
        }else{
            swal("很开心您放弃了本次操作!");
        }
    });


}

function loginout(){

    swal({
        title: "确认退出当前账号吗?",
        icon : "warning",
        dangerMode : true,
        buttons : [ "取消", "确认"],
    }).then(function(ok){
        if (ok) {
            $.ajax({
                url : "/user/stuloginout",//url 统一资源定位符
                type : "POST",
                success : function(result) {
                    if(result == '已退出'){
                        window.location.href = "login";
                        swal("退出成功!", "再次登录请前往登陆页面", "success");
                    }else{
                        swal("退出失败!", "用户名或密码出现错误", "error");
                    }
                },
                error : function(data) {
                    swal("退出成功!", "再次登录请前往登陆页面", "success");
                }
            });
        }else{
            swal("很开心您放弃了本次操作!");
        }
    });




}



function checkpwd(){
    var u_oldpwd = document.getElementById("u_oldpwd").value;
    if(u_oldpwd == null || u_oldpwd==''){
        swal("原密码不能为空!", "请输入原密码进行密码修改", "error");
        return false;
    }
    $.ajax({
        url : "/user/stucheckpwd?u_oldpwd="+u_oldpwd,//url 统一资源定位符
        type : "POST",
        success : function(result) {
            if(result == '密码存在'){

            }else{
                swal("原密码错误", "如忘记密码可在登录页进行忘记密码操作", "error");
            }
        },
        error : function(data) {

        }
    });
}

function submitpwd(){
    var u_newpwd = document.getElementById("u_newpwd").value;
    var u_surenewpwd = document.getElementById("u_surenewpwd").value;

    if(u_newpwd == null || u_newpwd==''){
        swal("新密码不能为空!", "请输入新密码进行密码修改", "error");
        return false;
    }

    if(u_newpwd.length<7){
        swal("新密码须超过6位!", "请重新输入", "error");
        document.getElementById("u_newpwd").value="";
        document.getElementById("u_surenewpwd").value="";
        return false;
    }
    if(u_newpwd != u_surenewpwd ){
        swal("两次密码不一致", "请重新输入密码", "error");
        document.getElementById("u_newpwd").value="";
        document.getElementById("u_surenewpwd").value="";
        return false;
    }
    $.ajax({
        url : "/user/stuupdatepwd?u_newpwd="+u_newpwd,//url 统一资源定位符
        type : "POST",
        success : function(result) {
            if(result == '已修改'){
                swal("修改成功!", "下次登陆请使用新密码进行登录", "success");
            }else{
                swal("原密码错误", "如忘记密码可在登录页进行忘记密码操作", "error");
            }
        },
        error : function(data) {

        }
    });
}


function loadCode(){
    $.ajax({
        url : "/acountQRCode/codePicture",//url 统一资源定位符
        type : "GET",
        success : function(result) {

            $("#imageId").attr("src",result)

        },
        error : function(data) {

        }
    });
}

function divFor(){
    var data = $('#searchform').serialize();//表单序列化 form表单的id属性值
    $.ajax({
        url : "/stuOperat/selectAllComp",//url 统一资源定位符
        type : "POST",
        data:data,
        success : function(result) {
          var compArr = result.data;
            document.getElementById("divFor").innerHTML='';
            for (var i=0;i<compArr.length;i++){
                a='<div class="col-md-4" >';
                a='<div class="panel" style="width: 31.3%;float: left;margin-left: 1%;margin-right:1%;height: 200px" id="forDiv'+i+'" onmouseover="showButton(this.id)" onmouseout="delButton(this.id)">';
                a += '<p style="font-size: 16px;font-weight: 900;margin-left: 20%;margin-top: 20px">'+compArr[i].comp_name+'</p>';
                a += '<p style="font-size: 12px;margin-left: 20%;color: #999">'+compArr[i].comp_kind+'</p>';
                a += '<p style="font-size: 14px;margin-left: 20%;color: red"><span>'+compArr[i].comp_cecruit+'</span><span style="margin-left: 20%;font-size: 12px">'+compArr[i].comp_salary+'</span></p>';
                a += '<p style="font-size: 12px;margin-left: 20%;margin-right:20%;color: #999">'+compArr[i].comp_province+compArr[i].comp_city+compArr[i].comp_county+compArr[i].comp_address+'</p>';

                a+='<div style="display:none;" class="mouseTap"   id="forDiv'+i+'son">';
                   a+='<button type="button" class="btn btn-info" data-dismiss="modal" style="font-size: 12px;margin-left: 33%;margin-bottom: 24px;" id="'+compArr[i].u_acount+'," onclick="selectCompByCount(this.id)" data-toggle="modal" data-target="#myModalJobWang">网申入口</button>' +
                    '<button type="button" class="btn btn-success" style="font-size: 12px;margin-bottom: 24px;margin-left: 20px;" id="'+compArr[i].u_acount+'" onclick="addShoucang(this.id)">添加收藏</button>';
                a+='</div>';
                a+='</div>';
                a+='</div>';
                $(".divFor").append(a);
            }


        },
        error : function(data) {

        }
    });
}

function showButton(event) {
    $("#"+event+"son").attr('style','display:block;');
}

function delButton(event) {
    $("#"+event+"son").attr('style','display:none;');
}
function divMhFor(){
    var data = $('#searchform').serialize();//表单序列化 form表单的id属性值
    $.ajax({
        url : "/stuOperat/selectAllMenHuInfo",//url 统一资源定位符
        type : "POST",
        data:data,
        success : function(result) {
            console.log(result.data);
            var compArr = result.data;
            document.getElementById("divMhFor").innerHTML='';
            for (var i=0;i<compArr.length;i++){
                a='<div class="col-md-4" id="forDiv">';
                a='<div class="panel" style="width: 31.3%;float: left;margin-left: 2%;height: 200px">';
                a += '<p style="font-size: 16px;font-weight: 900;margin-left: 25%;margin-top: 20px">'+compArr[i].recruit_name+'</p>';
                a += '<p style="font-size: 12px;margin-left: 25%;color: #999">招聘岗位：'+compArr[i].recruit_job+'</p>';
                a += '<p style="font-size: 14px;margin-left: 25%;color: #999"><span>宣讲会地址：'+compArr[i].recruit_address+'</span></p>';
                a += '<p style="font-size: 14px;margin-left: 25%;color: #999">宣讲会时间：'+compArr[i].recruit_time+'</p>';
                a+='<button type="button" class="btn btn-info" data-dismiss="modal" style="font-size: 12px;margin-left: 40%;margin-bottom: 24px;" id="'+compArr[i].u_acount+',">查看详情</button>';
                a+='</div>';
                a+='</div>';
                $(".divMhFor").append(a);
            }


        },
        error : function(data) {

        }
    });
}

function addShoucang(event) {
    var comp_acount = event;
    $.ajax({
        url : "/stuOperat/stuAttentComp?comp_acount="+comp_acount,//url 统一资源定位符
        type : "POST",
        success : function(result) {
            if(result == '收藏成功'){
                swal("收藏成功!", "请在我的收藏中进行查看", "success");
            }else if(result == '重复收藏'){
                swal("收藏失败", "请勿重复收藏", "error");
            }else{
                swal("收藏失败", "请检查网络设置或者联系管理员", "error");
            }
        },
        error : function(data) {

        }
    });

}

function onlineApplication(event){
    var comp_acount = event;
    $.ajax({
        url : "/stuOperat/stuOnlineApplication?comp_acount="+comp_acount,//url 统一资源定位符
        type : "POST",
        success : function(result) {
            if(result == '网申成功'){
                swal("网申成功!", "请耐心等待网申公司的回复", "success");
            }else if(result == '信息不完善'){
                swal("网申失败", "请完善简历信息之后，进行网申", "error");
            }else if(result == '重复网申'){
                swal("网申失败", "您已进行了该公司的网申，请勿重复操作", "error");
            }else{
                swal("网申失败", "请检查网络设置或者联系管理员", "error");
            }
        },
        error : function(data) {

        }
    });

    var stu_fromprovince = document.getElementById("stu_fromprovince");
    for(var i = 0; i < provenceArr.length; i++)
    {
        var o_l = new Option(provenceArr[i],provenceArr[i]);
        stu_fromprovince.options.add(o_l);
    }
}

var comp_acount=null;
function selectCompByCount(event){
     comp_acount = event;
    var arr = null;
    $.ajax({
        url : "/stuOperat/selectCompByCount?comp_acount="+comp_acount,//url 统一资源定位符
        type : "POST",
        success : function(result) {
           console.log(result.data[0]);
            var compCecruit = result.data[0].comp_cecruit
             arr = compCecruit.split(",")
            var compCecruitlist = document.getElementById("comp_cecruit_list");
            for(var i = 0; i < arr.length; i++)
            {
                var o_l = new Option(arr[i],arr[i]);
                compCecruitlist.options.add(o_l);
            }
            var  comp_name_wang = document.getElementById("comp_name_wang");
            comp_name_wang.innerHTML = result.data[0].comp_name;
            var  comp_kind = document.getElementById("comp_kind");
            comp_kind.innerHTML = result.data[0].comp_kind;
            var  comp_contact = document.getElementById("comp_contact");
            comp_contact.innerHTML = result.data[0].comp_contact;
            var  comp_contacttel = document.getElementById("comp_contacttel");
            comp_contacttel.innerHTML = result.data[0].comp_contacttel;
            var  comp_profile = document.getElementById("comp_profile");
            comp_profile.innerHTML = result.data[0].comp_profile;
        },
        error : function(data) {

        }
    });

}


function onlineApplication() {
    var compCecruit = document.getElementById("comp_cecruit_list").value;
    $.ajax({
        url: "/stuOperat/stuOnlineApplication?comp_acount=" + comp_acount+"&wangshenjob="+compCecruit,//url 统一资源定位符
        type: "POST",
        success: function (result) {
            if (result == '网申成功') {
                swal("网申成功!", "请耐心等待网申公司的回复", "success");
            } else if (result == '信息不完善') {
                swal("网申失败", "请完善简历信息之后，进行网申", "error");
            } else if (result == '重复网申') {
                swal("网申失败", "您已进行了该公司的网申，请勿重复操作", "error");
            } else {
                swal("网申失败", "请检查网络设置或者联系管理员", "error");
            }
        },
        error: function (data) {

        }
    });

}
function clearoption() {
    $("#comp_cecruit_list").load(location.href + " #comp_cecruit_list");
}